﻿namespace SchoolSystem.Server.Models
{
    using System;
    using System.Linq;
    using System.Linq.Expressions;
    using System.Runtime.Serialization;
    using SchoolSystem.Data;

    [DataContract(Name = "grade")]
    public class GradeModel
    {
        [DataMember(Name = "value")]
        public int Value { get; set; }

        [DataMember(Name = "dateRecieved")]
        public DateTime DateRecieved { get; set; }

        public static Expression<Func<Grade, GradeModel>> FromGrade
        {
            get
            {
                return g => new GradeModel()
                {
                    Value = g.Value,
                    DateRecieved = g.DateRecorded
                };
            }
        }
    }
}